import {uploadFile} from "@/utils/request.js"

// 上传图片接口
export function uploadAvatar(data = {}) {
    return uploadFile({
        url: "/user/avatar",
        method: "POST",
        filePath: data.filePath,
        name: data.name,
    }).then((res) => {
        // console.log('上传图片成功:', res);
        return res.data;
    }).catch((error) => {
        // console.error('上传图片失败:', error);
        throw error; // 抛出错误以便在调用处处理
    });
}